function urllocation($url) {
    window.location.href = $url;
}

function alertMess(message){
	message = message.replace(/ /g,"%20");
	$(function(){
		$.colorbox({
			href: url_default_lang+'/reclipcommon/alert?message='+message,
			transition: 'fade',
			opacity: 0.5,
			
		});

	});
}



function alertMessTimeOut(message,timeout){
	message = message.replace(/ /g,"%20");
	$(function(){
		$.colorbox({
			href: url_default_lang+'/reclipcommon/alert?message='+message,
			transition: 'fade',
			opacity: 0.5
		});

	});
	setTimeout(function() {
  		$.colorbox.close();
	}, timeout );
}


function loginAjax(usernameVal,passwordVal){
	
	$('#loadingimg').show();
	$.ajax({
		  type: "POST",
		  url: url_base+"jobmanager/login/login",
		  data: { username: usernameVal, password: passwordVal }
	}).done(function( msg ) {
		alert(msg);
		var res = parseInt(msg);
		if(res > -1){
			$('#loadingimg').hide();
			$.colorbox({html:"<div style='width: 200px; height: 150px;'><h2>jobmanager</h2><br /><hr /><H3>Login successfully</H3></div>"});
			$('#loginLink').hide();
			
			setTimeout(function() {
		  		$.colorbox.close();
			}, 2000 );
		}else{
			$.colorbox({html:"<div style='width: 200px; height: 150px;'><h2>jobmanager</h2><br /><hr /><H3>username or password incorrect</H3></div>"});
			
			setTimeout(function() {
				$(function(){
					$.colorbox({
						href: url_base+'jobmanager/index/displaylogin',
						transition: 'fade',
						opacity: 0.5,
						overlayClose: true,
						onLoad: function() {
						    $('#cboxClose').remove();
						}
					});
				});
			}, 1500 );
			
		}
	});
}
